package com.qi.spzx.manager.mapper;

import com.qi.spzx.model.entity.product.ProductDetails;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @Description TODO
 * @Author dingchunlin
 * @Date 2024/2/23 19:23
 * @Version 1.0.0
 */
@Mapper
public interface ProductDetailsMapper {
    @Select("select * from product_details where is_deleted = 1 and product_id #{productId};")
    String getDetailsByProductId(Long productId);

    @Insert("insert into product_details value(null,#{productId},#{imageUrls},now(),now(),1)")
    void save(ProductDetails productDetails);
    @Select("select * from product_details where is_deleted = 1 and product_id = #{productId}")
    ProductDetails selectByProductId(Long id);

    void updateById(ProductDetails productDetails);

    @Update("update product_details set is_deleted = 0 , update_time = now() where product_id = #{id}")
    void deleteByProductId(Long id);
}
